package com.feng.paper.controller;

import com.feng.common.vo.ApiRest;
import com.feng.paper.service.PaperService;
import com.feng.paper.vo.PaperVO;
import com.feng.paper.vo.QuDetailVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 试卷 前端控制器
 * </p>
 *
 * @author feng
 * @since 2023-03-23 20:30:41
 */
@RestController
@RequestMapping("/paper")
@CrossOrigin
@Api(tags = "试卷模块")
public class PaperController {

    @Autowired
    private PaperService paperService;

    @ApiOperation("通过考试id组卷")
    @GetMapping("exam/{examId}")
    public ApiRest awardPaper(@PathVariable String examId) {
        return paperService.awardPaper(examId);
    }

    @ApiOperation("返回试卷题目编号")
    @GetMapping("{paperId}")
    public ApiRest<PaperVO> returnPaper(@PathVariable String paperId) {
        return paperService.returnPaper(paperId);
    }

    @ApiOperation("查询试卷题目")
    @GetMapping("quDetail")
    public ApiRest<QuDetailVo> quDetail(String paperId, String quId) {
        return paperService.quDetail(paperId, quId);
    }

    @GetMapping("paper/{paperId}")
    @ApiOperation("交卷")
    public ApiRest<Integer> handPaper(@PathVariable String paperId) {
        return paperService.handPaper(paperId);
    }

}
